package com.ruoyi.business.uitls;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

//  随机生成店铺订单号
public class RepairNumber {
    public static Long generateRepairNumber() {
        // 时间戳
        Date now = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        String timeStamp = dateFormat.format(now);
        // 随机数
        Random random = new Random();
        int randomNumber = random.nextInt(9999); // 生成一个六位数的随机数
        String formattedRandomNumber = String.format("%03d", randomNumber); // 不足六位数的补0
        // 拼接
        String num = timeStamp + formattedRandomNumber;
        Long aLong = Long.valueOf(num);
        return aLong;
    }
}
